package com.atos.smp.actions;

import java.util.List;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import net.codeissue.web.common.ServiceFinder;

import org.primefaces.context.RequestContext;

import com.atos.smp.beans.Collaborator;
import com.atos.smp.business.CollaboratorManager;
import com.atos.smp.business.impl.CollaboratorManagerImpl;
import com.atos.smp.dao.CollaboratorDao;

@ManagedBean
@RequestScoped
public class CollaboratorBean {
	    
	private CollaboratorManager collaboratorManager;
	private Collaborator collaborator;
	private String das;
	public CollaboratorBean() {
		collaboratorManager = Action.getCollaboratorManager();
		collaborator = new Collaborator();
	}
	public String add(){
		collaboratorManager.save(collaborator);
		return "addSuccess";
	}
	
	public Collaborator getCollaborator() {
		return collaborator;
	}
	public void setCollaborator(Collaborator collaborator) {
		this.collaborator = collaborator;
	}
	public String getDas() {
		return das;
	}
	public void setDas(String das) {
		this.das = das;
		this.collaborator = collaboratorManager.findCollaboratorByDas(das);
	}
	
}
